package com.nulldev.util.encoding.nHash;

import java.util.LinkedList;

import com.nulldev.util.encoding.nHash.hash2.Hash2;
import com.nulldev.util.encoding.nHash.hash32.Hash32;
import com.nulldev.util.encoding.nHash.other.CRC32;
import com.nulldev.util.logging.Logger;
import com.nulldev.util.logging.LoggerFactory;

public class nHash {
	private static final Logger log = LoggerFactory.getLogger(true, true);
	private static final LinkedList<Hashable> enc = new LinkedList<Hashable>();
	
	static {
		if (enc.isEmpty()) {
			enc.add(new CRC32());
			enc.add(new Hash2());
			enc.add(new Hash32());
		}
	}
	
	public static Hashable getHasher(final String id) {
		for (final Hashable hashable : (LinkedList<Hashable>) enc.clone()) {
			if (hashable.hasherID().equals(id)) {
				return hashable;
			}
		}
		return null;
	}
}
